<?php
/**
 * 购物车
 * User: yuanxuncheng
 * Date: 2017/1/2
 * Time: 21:45
 */

namespace app\api\controller;

use app\api\model\page\cart\AddCart as AddCartModel;
use app\api\model\page\cart\EditCart as EditCartModel;
use app\api\model\page\cart\GetCart as GetCartModel;
use app\api\model\page\cart\GetNotSubmitCart as GetNotSubmitCartModel;
use app\api\model\page\cart\DeleteCart as DeleteCartModel;
use app\library\Error;
use think\Request;

class Cart
{

    private $addCartModel;
    private $editCartModel;
    private $getCartModel;
    private $deleteCartModel;
    private $getNotSubmitCartModel;

    public function __construct()
    {
        $this->param = Request::instance()->param();
    }

    /**
     * @desc 增加购物车
     * @return array
     */
    public function addCart()
    {
        $this->addCartModel = new AddCartModel();
        return $this->addCartModel->excute($this->param);
    }

    /**
     * @desc 编辑购物车
     * @return array
     */
    public function editCart()
    {
        $this->editCartModel = new EditCartModel();
        return $this->editCartModel->excute($this->param);
    }

    /**
     * @desc 获取购物车
     * @return array
     */
    public function getCart()
    {
        $this->getCartModel = new GetCartModel();
        return $this->getCartModel->excute($this->param);
    }

    /**
     * @desc 获取未提交购物车
     * @return array
     */
    public function getNotSubmitCart()
    {
        $this->getNotSubmitCartModel = new GetNotSubmitCartModel();
        return $this->getNotSubmitCartModel->excute($this->param);
    }

    /**
     * @desc 删除购物车
     * @return array
     */
    public function deleteCart()
    {
        $this->deleteCartModel = new DeleteCartModel();
        return $this->deleteCartModel->excute($this->param);
    }
}
